<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head id="MyHead">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="../resources/Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../resources/Scripts/jquery.easyui.min-1.3.5.js" type="text/javascript"></script>
        <script src="../resources/Scripts/jquery.datagrid.js" type="text/javascript"></script>
    <script src="../resources/Scripts/JScriptIndex.js" type="text/javascript"></script>
    <link href="../resources/Content/Default.css" rel="stylesheet" type="text/css" />
    <link href="../resources/Content/IndexStyle.css" rel="stylesheet" type="text/css" />

        <link href="../resources/Res/easyui/themes/icon.css" rel="stylesheet" type="text/css" />
        <script src="../resources/Res/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <link href="../resources/Res/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <title>
	
    学员

</title>
     <script type="text/javascript" language="javascript">
         $(function () {
             $.extend($.fn.datagrid.methods, {
                 addToolbarItem: function (jq, items) {
                     return jq.each(function () {
                         var dpanel = $(this).datagrid('getPanel');
                         var toolbar = dpanel.children("div.datagrid-toolbar");
                         if (!toolbar.length) {
                             toolbar = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(dpanel);
                             $(this).datagrid('resize');
                         }
                         var tr = toolbar.find("tr");
                         for (var i = 0; i < items.length; i++) {
                             var btn = items[i];
                             if (btn == "-") {
                                 $("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
                             } else {
                                 var td = $("<td></td>").appendTo(tr);
                                 var b = $("<a href=\"javascript:void(0)\"></a>").appendTo(td);
                                 b[0].onclick = eval(btn.handler || function () { });
                                 b.linkbutton($.extend({}, btn, {
                                     plain: true
                                 }));
                             }
                         }
                     });
                 },
                 removeToolbarItem: function (jq, param) {
                     return jq.each(function () {
                         var dpanel = $(this).datagrid('getPanel');
                         var toolbar = dpanel.children("div.datagrid-toolbar");
                         var cbtn = null;
                         if (typeof param == "number") {
                             cbtn = toolbar.find("td").eq(param).find('span.l-btn-text');
                         } else if (typeof param == "string") {
                             cbtn = toolbar.find("span.l-btn-text:contains('" + param + "')");
                         }
                         if (cbtn && cbtn.length > 0) {
                             cbtn.closest('td').remove();
                             cbtn = null;
                         }
                     });
                 }
             });
         });
    </script>
    
    
    <script type="text/javascript" language="javascript">
        $(function () {

            $('#flexigridData').datagrid({
                title: '推荐人招生明细', //列表的标题
                iconCls: 'icon-site',
                width: 'auto',
                height: 'auto',
                nowrap: true,
                striped: true,
                collapsible: true,
                url: '/TJRzhaoshengmingxi', //获取数据的url
                queryParams: { search: $('#tuijianrenStart_Time').val() + ',' + $('#tuijianrenEnd_Time').val() + ",null", id: "mingxiEXCEL" },
                
                sortName: 'PK_ID',
                sortOrder: 'desc',
                idField: 'PK_ID',

                toolbar: "#tuijianrenSearch",
                columns: [[

                
					  { field: 'SEname', title: '推荐人姓名', width: 80 }
					, { field: 'shuliang', title: '招生数量', width: 80 }
                     , { field: 'S_peixunfei', title: '实收', width: 80, sortable: true, align: 'right', formatter: function (value, rec) { return formatCurrency(value); } }
					, { field: 'StuName', title: '所招学员明细（姓名+实收）', width: 1250 }
					
                ]],
                pagination: true,
                rownumbers: true

            });
        });

                                  //查询
        //内部学员查询
        function findDataTuijianren() {
            var riqiStart_Time = $("#tuijianrenStart_Time").val(); //关键字
            var riqiEnd_Time = $("#tuijianrenEnd_Time").val(); //关键字
            var tuijianren = $("#tuijianren").val(); //关键字
            if (tuijianren == "") { tuijianren = "null" }
            if (riqiStart_Time == "") {
                $.message.alert('系统提示', '请输入开始日期', 'info');
                return false;
            }

            if (riqiEnd_Time == "") {
                $.message.alert('系统提示', '请输入开始日期', 'info');
                return false;
            }
            //执行查询
            //alert(search1);
            $('#flexigridData').datagrid('reload', { search: riqiStart_Time + ',' + riqiEnd_Time + ',' + tuijianren ,id:'mingxiEXCEL'});
        }
        //“导出EXCEL”按钮     在6.0版本中修改
        function flexiExport() {

            progress();
            var search = "";





            var filed = ['SEname', 'shuliang', 'S_peixunfei', 'StuName'];
            var title = ['推荐人姓名', '招生数量', '培训费总额', '所招学员明细（姓名+实收）'];
            
            //alert(search);
            var titlestr = title.join(",");

            $.post("../A_Report/ExportTJRMX",
                {
                    title: titlestr,
                    field: filed.join(","),
                    sortName: $('#flexigridData').datagrid('options').sortName,
                    sortOrder: $('#flexigridData').datagrid('options').sortOrder,
                    search: search,
                    filename1: ''
                }, function (res) {
                    // alert(res);
                    $.messager.progress('close');
                    window.location.href = res;
                });
            }
            function progress() {
                var win = $.messager.progress({
                    title: '请等待',
                    text: '数据正在处理中'
                });
            }
            //js过滤HTML标签以及空格
            function removeHTMLTag(str) {
                str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
                str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
                //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
                str = str.replace(/ /ig, ''); //去掉 
                return str;
            }
    </script>
    <script src="/Res/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

      <base target = "_self">
</head>
<body class="easyui-layout" style="padding:3px;">
    <table id="flexigridData" fit="true">
    </table>
    


   <div id="tuijianrenSearch" style=" padding:5px;">
    <div class="row">
        <span>&nbsp;报名日期：</span><input class="input-textbox" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'tuijianrenEnd_Time\');}'})"  type="text" id="tuijianrenStart_Time" value='2017-12-26' size="10" />
        &nbsp;到&nbsp;&nbsp;<input class="input-textbox" onclick="WdatePicker({minDate:'#F{$dp.$D(\'tuijianrenStart_Time\');}'})"  type="text" id="tuijianrenEnd_Time" value='2018-01-25' size="10" />
        &nbsp;推荐人：<input class="input-textbox" type="text" id="tuijianren" size="10" />
        &nbsp;<a href="javascript:findDataTuijianren();" class="easyui-linkbutton" data-options="iconCls:'icon-search'">统计</a>
        <a href="javascript:void(0);" onclick="flexiExport();" class="easyui-linkbutton" iconCls="icon-excel">导出EXCEL</a>
    </div>
</div>

        

</body>
</html>
